package com.weipai.demo.controller;

import com.weipai.demo.model.CreditCard;
import com.weipai.demo.service.CreditCardService;
import com.weipai.demo.util.LayuiTablePagingResult;
import com.weipai.demo.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 赵项阳
 * @Date: 2019/6/29 16:04
 * @Version 1.0
 */
@RestController
public class CreditCardController {

    @Autowired
    private CreditCardService creditCardService;


    //添加信用卡分类
    @RequestMapping(value = "/credit/cardClass")
    public Response cardClass(String designation,String attribute,Integer status,Integer id){
     return creditCardService.cardClass(designation,attribute,status,id);
    }

    //分页展示和信用卡分类消息
    @RequestMapping(value = "/credit/pageShow")
    public LayuiTablePagingResult pageShow(Integer page, Integer size, CreditCard creditCard){
        return creditCardService.pageShow(page,size,creditCard);
    }

    //删除信用卡列表消息
    @RequestMapping(value = "/credit/deleteById")
    public Response deleteById(Integer id){
        return creditCardService.deleteById(id);
    }

    //关键字搜索
    @RequestMapping(value = "/credit/searchBykeyword")
    public LayuiTablePagingResult searchBykeyword(Integer page,Integer size,CreditCard creditCard){
        return creditCardService.searchBykeyword(page,size,creditCard);
    }
    //信用卡列表
    @RequestMapping(value = "/credit/creditList")
    public LayuiTablePagingResult creditList(Integer page,Integer size,CreditCard creditCard){
        return creditCardService.getCreditList(page,size,creditCard);
    }

    //添加修改信用卡信息
    @RequestMapping(value = "/credit/editcredit")
    public Response editcredit(CreditCard creditCard){
        return creditCardService.editcredit(creditCard);
    }
    //上下架修改
    @RequestMapping(value = "/credit/changePublishStatus")
    public Response changePublishStatus(Integer id,Integer publishStatus){
        return creditCardService.changePublishStatus(id,publishStatus);
    }

    //删除银行卡
    @RequestMapping(value = "/credit/delcredit")
    public Response delcredit(Integer id){
        return creditCardService.delcredit(id);
    }


    //信用卡展示
    @RequestMapping(value = "/credit/showCredit")
    public Response showCredit(Integer id){
        return creditCardService.showCredit(id);
    }

    //推荐信用卡
    @RequestMapping(value = "/credit/recommended")
    public Response recommended(Integer size,Integer page){
        return creditCardService.recommended(page,size);
    }

    //热门银行卡
    @RequestMapping(value = "/credit/hotCard")
    public Response hotCard(){
        return creditCardService.hotCard();
    }
}
